package com.achievement.entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.user.entity.Student;
import com.user.entity.Teacher;

@Entity
@Table(name="t_course")
public class Course {
	private Long id;
	private String num;
	private String name;
	private Subject subject;
	private Teacher teacher;
	private List<Student> students;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public String getNum() {
		return num;
	}
	public String getName() {
		return name;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Subject getSubject() {
		return subject;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Teacher getTeacher() {
		return teacher;
	}
	@JsonIgnore
	@ManyToMany
	public List<Student> getStudents() {
		return students;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setNum(String num) {
		this.num = num;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}
	public void setStudents(List<Student> students) {
		this.students = students;
	}
	
}
